package com.ruoyi.deeplearn.service.impl;

import java.util.List;

import cn.hutool.core.util.IdUtil;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.deeplearn.mapper.DeepAlgorithmMapper;
import com.ruoyi.deeplearn.domain.DeepAlgorithm;
import com.ruoyi.deeplearn.service.IDeepAlgorithmService;

/**
 * 算法Service业务层处理
 * 
 * @author 任伟伟
 * @date 2022-12-10
 */
@Service
public class DeepAlgorithmServiceImpl implements IDeepAlgorithmService 
{
    @Autowired
    private DeepAlgorithmMapper deepAlgorithmMapper;

    /**
     * 查询算法
     * 
     * @param id 算法主键
     * @return 算法
     */
    @Override
    public DeepAlgorithm selectDeepAlgorithmById(Long id)
    {
        return deepAlgorithmMapper.selectDeepAlgorithmById(id);
    }

    /**
     * 查询算法列表
     * 
     * @param deepAlgorithm 算法
     * @return 算法
     */
    @Override
    public List<DeepAlgorithm> selectDeepAlgorithmList(DeepAlgorithm deepAlgorithm)
    {
        return deepAlgorithmMapper.selectDeepAlgorithmList(deepAlgorithm);
    }

    /**
     * 新增算法
     * 
     * @param deepAlgorithm 算法
     * @return 结果
     */
    @Override
    public int insertDeepAlgorithm(DeepAlgorithm deepAlgorithm)
    {
        deepAlgorithm.setId(IdUtil.getSnowflakeNextId());
        deepAlgorithm.setCreateTime(DateUtils.getNowDate());
        return deepAlgorithmMapper.insertDeepAlgorithm(deepAlgorithm);
    }

    /**
     * 修改算法
     * 
     * @param deepAlgorithm 算法
     * @return 结果
     */
    @Override
    public int updateDeepAlgorithm(DeepAlgorithm deepAlgorithm)
    {
        deepAlgorithm.setUpdateTime(DateUtils.getNowDate());
        return deepAlgorithmMapper.updateDeepAlgorithm(deepAlgorithm);
    }

    /**
     * 批量删除算法
     * 
     * @param ids 需要删除的算法主键
     * @return 结果
     */
    @Override
    public int deleteDeepAlgorithmByIds(Long[] ids)
    {
        return deepAlgorithmMapper.deleteDeepAlgorithmByIds(ids);
    }

    /**
     * 删除算法信息
     * 
     * @param id 算法主键
     * @return 结果
     */
    @Override
    public int deleteDeepAlgorithmById(Long id)
    {
        return deepAlgorithmMapper.deleteDeepAlgorithmById(id);
    }
}
